package xuecheng.spring.boot.start.common.hashing.impl;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.commons.codec.digest.DigestUtils;
import xuecheng.spring.boot.start.common.hashing.HashingUtils;

/**
 * desc md5 实现
 * <p/>
 *
 * @author PengXueCheng
 * @mail yingcheng1016@gmail.com,chengpx_org@163.com
 * create time 2020/3/9 17:44
 * project spring-boot-start-common
 * <p/>
 **/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class HashingUtilsMd5Impl implements HashingUtils {

    private static final HashingUtilsMd5Impl INSTANCE = new HashingUtilsMd5Impl();

    public static HashingUtilsMd5Impl getInstance() {
        return INSTANCE;
    }

    @Override
    public String encode(String data) {
        return DigestUtils.md5Hex(data);
    }

//    @Override
//    public String decode(String data) {
//        throw new UnsupportedOperationException("MD5算法不支持解密");
//    }

}
